function refreshRem() {
    document.documentElement.style.fontSize = ((screen.width < window.innerWidth ? screen.width : window.innerWidth) / 750) * 100 + 'px';
}

window.addEventListener('resize', function () {
    clearTimeout(tid);
    tid = setTimeout(refreshRem, 300);
}, false);
window.addEventListener('pageshow', function (e) {
    if (e.persisted) {
        clearTimeout(tid);
        tid = setTimeout(refreshRem, 300);
    }
}, false);
var tid;
refreshRem()
